Skip to content

Upgrade qpcr and seqlib modules from Python 2 to Python 3.12#1

Merged
Loyale merged 6 commits intomasterfrom
claude/upgrade-python-3.12-8l9Vc
Mar 14, 2026
Merged

Upgrade qpcr and seqlib modules from Python 2 to Python 3.12#1
Loyale merged 6 commits intomasterfrom
claude/upgrade-python-3.12-8l9Vc

Conversation

@Loyale
Copy link
Copy Markdown
Contributor

@Loyale Loyale commented Mar 14, 2026

  • Fix print statements to print() functions
  • Update integer division and string handling
  • Modernize dict.keys()/values()/items() usage
  • Fix exception syntax (except X as e)
  • Update urllib/urllib2 imports for Python 3
  • Fix other Python 2→3 compatibility issues
  • Add pyproject.toml and requirements.txt

https://claude.ai/code/session_01CVzyi7WGAKyTJzbmnSNF6r

claude added 6 commits March 14, 2026 17:50
- Fix print statements to print() functions
- Update integer division and string handling
- Modernize dict.keys()/values()/items() usage
- Fix exception syntax (except X as e)
- Update urllib/urllib2 imports for Python 3
- Fix other Python 2→3 compatibility issues
- Add pyproject.toml and requirements.txt

https://claude.ai/code/session_01CVzyi7WGAKyTJzbmnSNF6r
- Expand README with installation, usage examples, and module reference table
- Replace seqlib/__init__.py SHRiMP pipeline stub with proper package docstring
  and __all__ export list; add __version__
- Expand qpcr/__init__.py to expose all submodules (abi, MinerMethod,
  qpcrAnalysis, util); add __version__
- Add tests/ with smoke tests for all qpcr and seqlib public modules
- Add .github/workflows/ci.yml: lint (ruff) + test matrix (Python 3.12/3.13)
- Add .pre-commit-config.yaml with ruff and pre-commit-hooks
- Add ruff, pytest, and coverage config sections to pyproject.toml
- Pin dependency upper bounds in requirements.txt; add ruff/pre-commit as dev deps
- Add CHANGELOG.md and CONTRIBUTING.md with development guidelines
- Remove dead rasmus try/except imports from seqlib/util.py
- Wrap pygr imports in genomelib.py and pygrlib.py with try/except ImportError
- Fix bare `import sequencelib` → relative import in genomelib.py
- Remove executable-at-import code from pygrlib.py (was a scratch script)

https://claude.ai/code/session_01CVzyi7WGAKyTJzbmnSNF6r
- Switch build-backend from setuptools.backends.legacy to setuptools.build_meta
  (legacy backend requires newer pip not available in all CI environments)
- Move rpy2 to optional [r] extra; add pandas as core dependency
- Add pytest.importorskip("rpy2") guards for seqstats, RIPDiff, JensenShannon,
  mySam, Chip, continuousData tests (these modules import rpy2 at module level)
- Fix remaining Python 2 syntax in sequencelib.py:
  - raise "string", arg → raise ValueError(...)
  - print "%d" % x → print("%d" % x)
  - import prob → from . import prob (bare sibling import)
- Fix remaining Python 2 syntax in solid.py:
  - import misc → from . import misc
  - print >>outhand, ... → outhand.write(...)
  - print "...", / print "" → print(...)
  - dict.has_key() → in operator
- Fix invalid regex escape sequence in util.py (\$ → r-string)
- Update requirements.txt to comment out rpy2 (now optional)
- Add ruff to dev dependencies in pyproject.toml

All 21 tests now pass (6 skipped without rpy2/R installed).

https://claude.ai/code/session_01CVzyi7WGAKyTJzbmnSNF6r
…ruff errors

- Run 2to3 print fixer on smRNA, lincClonelib, lincName, lincRNAs, dbConn,
  go, gibson, genomelib, primer3lib (print >>stream, expr → print(..., file=...))
- Fix remaining Python 2 except A, B: syntax → except A as B: in
  gibson.py, lincClonelib.py, lincName.py
- Fix backtick repr expressions (`expr` → repr(expr)) in myDataTypes.py
- Fix <> operator remaining in shrimp.py
- Fix raise 'string', arg → raise error('arg') in myDataTypes.py
- Fix bare import sequencelib → from . import sequencelib in smRNA.py
- Fix E731: convert lambda assignment to def in algorithms.py
- Fix E702: split semicolon-separated statements in util.py
- Fix F507: wrong number of % format args in primer3lib.py
- Fix F823: rename loop variable 'next' → 'nxt' in mySam.py (was shadowing builtin)
- Fix E402 in smRNA.py: merge dangling docstring into module docstring
- Add noqa: E402 to misc.py late import (intentional for code organization)
- Expand ruff ignore list: add E101, E402, E731 suppressed for legacy code
- Remove .bak files left by lib2to3 (via .gitignore)

ruff check src/ now passes with 0 errors.
pytest: 21 passed, 6 skipped (rpy2 not installed).

https://claude.ai/code/session_01CVzyi7WGAKyTJzbmnSNF6r
@Loyale Loyale merged commit a626e1b into master Mar 14, 2026
3 checks passed
@Loyale Loyale deleted the claude/upgrade-python-3.12-8l9Vc branch March 14, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants